<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <title>搜索 ${(word)!} - PublicCMS</title>
        <meta name="keywords" content="搜索,${(word)!}"/>
        <meta name="description" content="搜索  ${(word)!}"/>
        <@tools.includePlace path="/common/8ddab9ba-a8aa-4745-86c6-66bf1c2c976c.html"/> <#-- header -->
    </head>
    <body>
        <@tools.includePlace path="/common/c32a4f4a-ff5d-49cf-bb59-5d9784539174.html"/> <#-- 导航 -->
        <div class="banner-l3 position-relative d-flex align-items-center justify-content-center" style="background:#22407c url(${site.sitePath}assets/img/banner-l3-bg-1.png) 50% 50% no-repeat;">
            <div class="container text-center position-relative py-3 py-md-4 text-white">
                <div class="breadcrumbs fs-7 text-white d-inline-flex align-items-center text-opacity-50">
                    <a href="${site.sitePath}">首页</a>  &gt; <a href="${site.dynamicPath}search/">搜索</a>
                </div>
            </div>
        </div>

        <div class="container">
            <div class="row">
                <div class="col-12 mt-5">
                    <form action="./" method="get" name="search">
                        <div class="input-group mb-3" style="border-radius: 10px;padding: 10px;background-color: rgba(0,0,0,.05);">
                            <input type="search" class="form-control fs-3" name="word" placeholder="您想搜索什么？" value="${(word)!}">
                            <button class="btn btn-primary flex-shrink-0 px-2 px-md-5 fs-4" type="submit">立即搜索</button>
                        </div>
                        <div class="form-check form-switch d-inline-block">
                          <input class="form-check-input" type="checkbox" name="phrase" id="phrase" value="true"<#if phrase?has_content && 'true'=phrase> checked="checked"</#if> onclick="$('form[name=search]').submit();">
                          <label class="form-check-label" for="phrase">精确搜索</label>
                        </div>
                        <a href="${site.dynamicPath}search/facet.html" onclick="$('form[name=search]').attr('action','${site.dynamicPath}search/facet.html').submit();return false;"  class="ms-5">
                            <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M239.40800000000002 459.552a220.144 220.144 0 1 0 440.288 0 220.144 220.144 0 1 0-440.288 0z" fill="#CACBCC"/><path d="M459.552 39.744c231.84 0 419.808 187.952 419.808 419.808 0 231.84-187.952 419.808-419.808 419.808S39.744 691.408 39.744 459.552 227.68 39.744 459.552 39.744zm0 104.96c-173.888 0-314.864 140.96-314.864 314.848S285.648 774.4 459.552 774.4C633.44 774.4 774.4 633.44 774.4 459.52c0-173.872-140.96-314.848-314.88-314.848z" fill="#1083E6"/><path d="M681.738 702.0909999999999q33.941-33.942 67.883 0l200.693 200.693q33.942 33.941 0 67.882-33.94 33.942-67.882 0L681.738 769.973q-33.94-33.942 0-67.883z" fill="#1083E6"/></svg>
                            高级搜索
                        </a>
                    </form>

<#if word?has_content || tagIds?has_content>
    <@cms.search word=word tagId=tagIds phrase=phrase highlight=true pageIndex=pageIndex pageSize=10>
            <#if page.totalCount gt 0>
                    <header class="tab-header fs-5 mt-5">
                        <b class="pb-2">搜索结果</b>
                    </header>
                    <div class="article-list" data-diy="content">
                        <#list page.list as a>
                        <a href="${a.url}" class="d-block" data-diy-item="${a.id}">
                            <div class="card flex-md-row align-items-start">
                                <div class="card-body py-3 py-md-0 px-0 px-md-3">
                                    <h5 class="text-body">${a.title?no_esc}</h5>
                                    <p class="fs-7 text-secondary">${(a.description?no_esc)!}</p>
                                    <footer class="fs-8 text-secondary text-opacity-50 d-flex align-items-center">
                                        <span class="me-4 d-inline-flex align-items-center"><img src="${site.sitePath}assets/img/icon-calendar.svg">${a.publishDate?date}</span>
                                        <span class="me-4 d-inline-flex align-items-center"><img src="${site.sitePath}assets/img/icon-view.svg">${a.clicks!}</span>
                                        <span class="me-4 d-inline-flex align-items-center"><img src="${site.sitePath}assets/img/icon-comment.svg">${a.comments!}</span>
                                    </footer>
                                </div>
                            </div>
                        </a>
                        </#list>
                    </div>
                    <ul class="pagination mt-5 overflow-auto pb-3">
                        <#assign url='./?word='+(word?url)!/>
                        <#if phrase?has_content>
                            <#assign url+='&phrase='+phrase?url/>
                        </#if>
                        <#if tagIds?has_content>
                            <#list tagIds as t>
                                <#assign url+='&tagIds='+t/>
                            </#list>
                        </#if>
                        <li class="page-item">
                            <a class="page-link" href="${getPage(url,page.prePage,'pageIndex')}" aria-label="Previous">
                                <span aria-hidden="true">«</span>
                            </a>
                        </li>
                        <#assign start=1/>
                        <#if (page.pageIndex-5) gt start>
                            <#assign start=page.pageIndex-4/>
                        </#if>
                        <#assign end=page.totalPage/>
                        <#if (page.pageIndex+5) lt end>
                            <#assign end=page.pageIndex+4/>
                        </#if>
                        <#list start..end as a>
                        <li class="page-item<#if a=page.pageIndex> active</#if>"><a class="page-link" href="${getPage(url,a,'pageIndex')}">${a}</a></li>
                        </#list>
                        <li class="page-item">
                            <a class="page-link" href="${getPage(url,page.nextPage,'pageIndex')}" aria-label="Next">
                                <span aria-hidden="true">»</span>
                            </a>
                        </li>
                    </ul>
        </#if>
    </@cms.search>
</#if>
                </div>
            </div>
        </div>
		<script>
			var templatePath='${.current_template_name?keep_after('/')}';
		</script>
        <@tools.includePlace path="/footer/7f8bacb5-30ca-4641-b66f-987d447b1a85.html"/> <#-- footer -->
    </body>
</html>
